
package com.mephi.util;

/**
 * It can differ sort of castling.
 * @author mephisto
 * 2011-06-23
 */
public enum CastlingSort
{
	SHORT(Constants.SHORT_CASTLING), LONG(Constants.LONG_CASTLING);

	
	/**
	 * 
	 * if s equals to '0-0' return {@code CastlingSort.SHORT} 
	 * if s equals to '0-0-0' return {@code CastlingSort.LONG} 
	 * in the other case returns {@code null}
	 * 
	 * @param s the string to set
	 * 			
	 * @return CastlingSort indicated by the string s
	 */
	public static CastlingSort valueOfString(String s)
	{
		s = s.trim();
		if (s.equals(Constants.SHORT_CASTLING))
			return CastlingSort.SHORT;
		else if  (s.equals(Constants.LONG_CASTLING))
			return CastlingSort.LONG;
		return null;
	}
	
	/**
	 * 
	 * @return the value of the CastlingSort
	 */
	public String getValue()
	{
	   return value;
	}
	
	private CastlingSort(String value) 
	{
	   this.value = value;
	}
	
	
	private String value;
}
